package com.web.cms.doc.dao;

import com.blue.jdbc.BaseDao;
import com.web.cms.doc.model.Web;
import org.springframework.stereotype.Repository;

@Repository("cmsWebDao")
public class WebDao extends BaseDao<Web>
{
	public WebDao()
	{
	}

	@Override
	protected void query(StringBuilder sql, Web param)
	{
		if (param != null)
		{
			if (param.getState() != null)
				sql.append(" and a.state=:state");
			
			if (param.getCode() != null && !param.getCode().isEmpty())
				sql.append(" and a.code=:code");
			
			if (param.getName() != null && !param.getName().isEmpty())
			{
				sql.append(" and a.name like :name");
				param.setName("%" + param.getName() + "%");
			}
		}
	}
	
}
